-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') vtag=GetVarInt(mg.request_info.query_string,'vtag') or -1 ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE) ct:Append([=[

# ライブラリ

]=]) dirname=nil index=GetVarInt(mg.request_info.query_string,'i',1,#LIBRARY_LIST) if index then dir=DocumentToNativePath(LIBRARY_LIST[index]) if dir then dirhash=mg.get_var(mg.request_info.query_string,'d') if dirhash then for i,v in ipairs(edcb.FindFile(dir..'\\*',0) or {}) do if v.isdir and mg.md5(v.name)==dirhash then dir=dir..'\\'..v.name dirname=LIBRARY_LIST[index]..'/'..v.name break end end else dirname=LIBRARY_LIST[index] end end end if not dirname then ct:Append('
\n') else hash=mg.get_var(mg.request_info.query_string,'h') if not hash then sort=mg.get_var(mg.request_info.query_string,'s') or 'dd' ct:Append('
\n') else xq=GetTranscodeQueries(mg.request_info.query_string) ct:Append('
\n') tsx=edcb.GetPrivateProfile('SET','TSExt','.ts','EpgTimerSrv.ini') info=nil for i,v in ipairs({table.unpack(MEDIA_EXTENSION_LIST),tsx}) do for j,w in ipairs(edcb.FindFile(dir..'\\*'..v,0) or {}) do if not w.isdir and mg.md5(w.name)==hash then info=w info.ists=v==tsx break end end if info then break end end edcb.htmlEscape=15 if info then ref=dirname..'/'..info.name ct:Append('Parent directory ..
\n' ..'→Video' or '0">DL')..'
\n') ct:Append((vtag==1 and '
' ..'
' ..'
' ..'/'..EdcbHtmlEscape(ref)..(vtag==1 and '
\n' ..'
'..PathToRoot()..mg.url_encode(ref):gsub('%%2f','/'):gsub('%.[0-9A-Za-z]+$','') ..'.psc
\n'..VideoScriptTemplete() or '')) if info.ists then fsec,fsize=0,0 f=edcb.io.open(dir..'\\'..info.name,'rb') if f then fsec,fsize=GetDurationSec(f) f:close() end ct:Append(' ('..('%dm%02ds|'):format(math.floor(fsec/60),fsec%60)..math.floor(fsize/1048576)..'M)
\n' ..'
\n' ..(vtag==0 and '\n' or '\n' ..(dirhash and '\n' or '') ..'\n\n') ..'\n' ..TranscodeSettingTemplete(xq,fsec) ..'
') if vtag==10 then src='xcode.lua?fname='..mg.url_encode(ref)..ConstructTranscodeQueries(xq) ct:Append('\n
' ..'
' ..'
' ..'xcode
') if ALLOW_HLS then ct:Append('\n
'..src..'
\n'..HlsScriptTemplete(xq.caption)) end end else ct:Append(' ('..math.floor(info.size/1048576)..'M)
\n') end end ct:Append('
\n') end end ct:Append([=[
]=]) ct:Finish() mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len)..(ct.gzip and 'Content-Encoding: gzip\r\n' or '')..'\r\n'))